package com.zhanghe.study.spring4.annotation.config;

import com.zhanghe.study.spring4.annotation.bean.Person;
import com.zhanghe.study.spring4.annotation.config.bean.Color;
import com.zhanghe.study.spring4.annotation.config.condition.MyCondition;
import com.zhanghe.study.spring4.annotation.config.registrar.MyImportBeanDefinitionRegistrar;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;

/**
 * 条件以及组件引入
 * @author zh
 * @date 2021/2/21 12:33
 */
@Configuration
//@Import({Red.class})
//@Import(MyImportSelector.class)
@Import({Color.class,MyImportBeanDefinitionRegistrar.class})
public class MainConfig2 {

    @Bean
    @Conditional(MyCondition.class)
    public Person person2(){
        return new Person("12",2);
    }

}
